package ru.niir.goodfil.ui;

import javassist.NotFoundException;
import ru.niir.goodfil.db.DataExchange;
import ru.niir.goodfil.exceptions.GoodfilSecurityException;
import ru.niir.goodfil.exceptions.ValidationException;

/**
 * Бин для работы стартовой страници.
 */
public class StartPageBean extends PageBean
{
    public StartPageBean() throws GoodfilSecurityException{
        if (!getSecurityBean().getIsEmployee()) throw new GoodfilSecurityException();
    }

    private String sessionId = "";

    public String getSessionId()
    {
        if (!getSecurityBean().getIsEmployee()) throw new GoodfilSecurityException();

        return sessionId;
    }

    public void setSessionId(String sessionId)
    {
    }

    public void addRestsDataExchange(){
        DataExchange dataExchange = new DataExchange();
        dataExchange.setTableName("Rests");
        dataExchange.setItemId(0);
        try {
            gf().addDataExchange(dataExchange);
        } catch (ValidationException e) {
            //logger.error(e.getMessage());
        }
    }
}
